import java.io.*;
import java.util.*;
public class test{
    public static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    // 蓝桥杯 买瓜(70%解法)(⭐⭐⭐⭐)
    public static int n;
    public static long m;
    public static long[] arr;
    public static boolean[] count;
    public static long min = 0x3f3f3f3f3f3f3fl;
    public static void main(String[] args) throws IOException {
        n = in.nextInt();
        m = in.nextLong() * 2l;
        arr = new long[n + 1];
        count = new boolean[n + 1];
        for(int i = 1;i <= n;i++){
            arr[i] = in.nextLong() * 2l;
        }
        dfs(1,0,0);
        System.out.println(min == 0x3f3f3f3f3f3f3fl ? -1 : min);
    }
    public static void dfs(int index,int num,long weight){
        if(num >= min || weight > m){
            return;
        }
        if(weight == m){
            min = num;
            return;
        }
        for(int i = index;i <= n;i++){
            dfs(i + 1,num,weight + arr[i]);
            if(!count[i]) {
                count[i] = true;
                arr[i] /= 2;
                dfs(i + 1,num + 1,weight + arr[i]);
                count[i] = false;
                arr[i] *= 2;
            }
        }
    }
    // 蓝桥杯 四位数密码锁(⭐⭐)
    public static int num;
    public static void main2(String[] args) throws IOException {
        dfs(4,0,1);
        System.out.println(num);
    }
    public static void dfs(int n,int m,int sum){
        if(m == n){
            if(sum == 384){
                num++;
            }
            return;
        }
        for(int i = 1;i <= 9;i++){
            dfs(n,m + 1,sum * i);
        }
    }
    // 蓝桥杯 连连看(⭐⭐⭐)
    public static void main3(String[] args) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        int sum = 0;
        ArrayList<int[]>[] list = new ArrayList[1005];
        boolean[] count = new boolean[1005];
        int[][] arr = new int[n + 1][m + 1];
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                arr[i][j] = in.nextInt();
                if(!count[arr[i][j]]){
                    list[arr[i][j]] = new ArrayList<>();
                    count[arr[i][j]] = true;
                }
                list[arr[i][j]].add(new int[]{i,j});
            }
        }
        for(int i = 1;i <= 1000;i++){
            if(!count[i]) continue;
            for(int j = 0;j < list[i].size();j++){
                int[] t1 = list[i].get(j);
                for(int k = j + 1;k < list[i].size();k++){
                    int[] t2 = list[i].get(k);
                    //a       b       c       d
                    //t1[0]   t1[1]   t2[0]   t2[1]
                    //|a - c| = |b - d|
                    if(Math.abs(t1[0] - t2[0]) == Math.abs(t1[1] - t2[1])){
                        // a != c && b != d (>0)
                        if((t1[0] != t2[0]) || (t1[1] != t2[1])){
                            sum += 2;
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
}
class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}